# -*- coding:utf-8 -*-
'''
@Author: lindes
'''
import xadmin

from .models import Category, Article, CollectArticle, PraiseArticle, InformArticle, CommentArticle, Race


class CategoryAdmin:
    list_display = ['name', 'ordered', 'parent_category', 'add_time']
    list_filter = ['name', 'ordered', 'add_time']
    search_fields = ['name', 'ordered', 'add_time']


class ArticleAdmin:
    list_display = ['title', 'author', 'category', 'content', 'click_count', 'praise_count', 'comment_count',
                    'collect_count', 'inform_count']
    list_filter = ['title', 'author', 'category', 'content', 'click_count', 'praise_count', 'comment_count',
                   'collect_count', 'inform_count']
    search_fields = ['title', 'content']
    style_fields = {"content": "ueditor"}


class CollectArticleAdmin:

    list_display = ['user', 'good_article', 'add_time']

    list_display = ['user', 'article', 'add_time']

    list_filter = ['add_time']
    search_fields = ['user']


class PraiseArticleAdmin:

    list_display = ['user', 'good_article', 'add_time']

    list_display = ['user', 'article', 'add_time']

    list_filter = ['add_time']
    search_fields = ['user']


class InformArticleAdmin:

    list_display = ['user', 'good_article', 'add_time']

    list_display = ['user', 'article', 'add_time']

    list_filter = ['add_time']
    search_fields = ['user']


class CommentArticleAdmin:

    list_display = ['user', 'good_article', 'pid', 'content', 'add_time']

    list_display = ['user', 'article', 'pid', 'content', 'add_time']

    list_filter = ['content', 'add_time']
    search_fields = ['user', 'content']


class RaceAdmin:
    list_display = ['race_category', 'begin', 'end', 'team_a', 'point_a', 'team_b', 'point_b', 'add_time',
                    'update_time', ]
    list_filter = ['race_category', 'team_a', 'team_b', 'add_time']
    search_fields = ['race_category', 'team_a', 'team_b']


xadmin.site.register(Category, CategoryAdmin)
xadmin.site.register(Article, ArticleAdmin)
xadmin.site.register(CollectArticle, CollectArticleAdmin)
xadmin.site.register(PraiseArticle, PraiseArticleAdmin)
xadmin.site.register(InformArticle, InformArticleAdmin)
xadmin.site.register(CommentArticle, CommentArticleAdmin)
xadmin.site.register(Race, RaceAdmin)
